
package com.showdor.springboot.rocketmq;

import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: lijb6
 * @Version 1.0
 */
@RestController
public class RocketmqProducerController {
    /*@Autowired
    private RocketMQTemplate rocketMQTemplate;

    @GetMapping("/rocketmq/{topic}/{num}")
    public void sendMsg(@PathVariable("topic") String topic, @PathVariable Integer num) {
        List<JSONObject> list = new ArrayList<>();
        for (int i = 1; i < num; i++) {
            JSONObject jo = new JSONObject();
            JSONObject jo2 = new JSONObject();
            jo2.put("id", i + new Random().nextInt(200));
            jo.put("product", jo2);
            jo.put("create_time", new Date());
            jo.put("update_time", new Date());
            jo.put("product_name", "产品名称 " + i);
            jo.put("status", 1);
            list.add(jo);
        }
        rocketMQTemplate.convertAndSend(topic, JSONObject.toJSONString(list));
    }*/
}
